import {request} from '@/utils/request'

const base = '/users'

export function findUsers(key, current = 1, pageSize = 10) {
  return request({
    url: base,
    method: 'get',
    params: {
      current,
      pageSize,
      key
    }
  })
}

export function addUser(data) {
  return request({
    url: base,
    method: 'post',
    data
  })
}

export function deleteUser(userId) {
  return request({
    url: `${base}/${userId}`,
    method: 'delete'
  })
}

export function updateUserSetting(data) {
  return request({
    url: `${base}/${data.id}/setting`,
    method: 'patch',
    data
  })
}


export function updateMyInfo(data) {
  return request({
    url: `${base}/my-info`,
    method: 'patch',
    data
  })
}

export function updateMyPwd(data) {
  return request({
    url: `${base}/my-pwd`,
    method: 'patch',
    data
  })
}


